<!DOCTYPE html>
<html>
  <%= render(:partial => "shared/head") %>
  <body class="<%= @time %>">
    <div id="rootWrapper">
      <div id="root" class="<%= @page["name"] %>">
        <div id="header">
          <div class="messagesAndTowns">
            <div class="flashContainer">
              <% flash.each do |key, value| %>
                <div class="flash <%= key %>"><%= value %></div>
              <% end %>
              <% if current_user %>
                <div class="welcomeUser">
                  <%= t("site.user.welcome", :login => current_user.login) %>
                </div>
              <% end %>
            </div>
            <div id="towns">
              <div class="townsLeft"></div>
              <% @towns.each do |item| %>
                <span class="town <%= "townSelected" if item.keyword == @town %>"><%= link_to item.name, main_path(:town => item.keyword, :time => @time) %></span>
              <% end %>
              <div class="townsRight"></div>
            </div>
          </div>
          <div class="infoAndOrders">
            <%= render(:partial => "shared/user_info") %>
            <div id="ordersDayNight">
              <div id="orderDay">
                <%= link_to(t("activerecord.attributes.town.day"), :time => "day", :town => @town) %>
                <div class="orderTime"><%= link_to(@town_entity.day, :time => "day", :town => @town) %></div>
              </div>
              <div id="orderNight">
                <%= link_to(t("activerecord.attributes.town.night"), :time => "night", :town => @town) %>
                <div class="orderTime"><%= link_to(@town_entity.night, :time => "night", :town => @town) %></div>
              </div>
            </div>
          </div>
        </div>
        <div id="middle">
          <div id="left">
            <div id="clockContainer">
              <div id="clock">
                <span id="sec"></span>
                <span id="hour"></span>
                <span id="min"></span>
              </div>
            </div>
            <div id="leftContainer">
              <div id="leftNavTop"><%= t("site.label.shop_catalog") %></div>
              <div id="townShops">
                <% @townShops.each do |shop| %>
                  <div class="townShop"><%= link_to shop.name, categors_path(:time => @time, :town => @town, :shop_id => shop.id) %></div>
                <% end %>
              </div>
              <div class="townShopFooter"></div>
              <div id="newShop"><%= link_to t("site.label.new_contact"), new_contact_path(:time => @time, :town => @town) %></div>
              <div id="leftBanners">
                <% @left_banners.each do |banner| %>
                  <a href="<%= banner.href %>" class="leftBanner">
                    <img src="<%= banner.photo.url %>" alt="<%= banner.name %>" />
                  </a>
                <% end %>
              </div>
            </div>
          </div>
          <div id="rightWrapper">
            <div id="headerPicture">
              <div id="topMenu">
                <% SITE["top_menu"].each_with_index do |item, index| %>
                  <div class="topMenuItem<%= " topMenuItemFirst" if index == 0 %><%= " topMenuItemSelected" if item == params[:action] %>">
                    <%= link_to(t("content.#{item}.name"), :controller => "content", :action => item, :time => @time, :town => @town) %>
                  </div>
                <% end %>
              </div>
            </div>
            <div id="centerAndRight">
              <div id="right">
                <div id="cart">
                  <div class="cartTitle"><%= t "site.cart.title" %></div>
                  <div class="cartTotal">
                    <% if @total %>
                      <div class="cartTotalPrice">
                        <span class="cartTotalPricePrefix"><%= t "site.cart.price.prefix" %></span>
                        <span class="cartTotalPriceValue"><%= @total[:price] %></span>
                        <span class="cartTotalPriceSuffix"><%= t "site.cart.price.suffix" %></span>
                      </div>
                      <div class="cartTotalQuantity">
                        <span class="cartTotalQuantityPrefix"><%= t "site.cart.quantity.prefix" %></span>
                        <span class="cartTotalQuantityValue"><%= @total[:quantity] %></span>
                        <span class="cartTotalQuantitySuffix"><%= t "site.cart.quantity.suffix" %></span>
                      </div>
                      <div class="cartButton"><%= link_to "Увійти", cart_show_path(:time => @time, :town => @town) %>
                      </div>
                    <% end %>
                  </div>
                </div>
                <div id="rightBanners">
                  <% @right_banners.each do |banner| %>
                    <a href="<%= banner.href %>" class="rightBanner">
                      <img src="<%= banner.photo.url %>" alt="<%= banner.name %>" />
                    </a>
                  <% end %>
                </div>
              </div>
              <div id="center">
                <div id="top">
                  <div id="topBanners">
                    <div id="s3slider">
                      <div id="s3sliderContent">
                        <% @top_banners.each do |banner| %>
                          <a href="<%= banner.href %>" class="s3sliderImage">
                            <img src="<%= banner.photo.url %>" alt="<%= banner.name %>" />
                            <span><%= banner.text %></span>
                          </a>
                        <% end %>
                        <div class="clear s3sliderImage"></div>
                      </div>
                    </div>
                  </div>
                </div>
                <div class="contentBlock">
                  <%= yield %>
                </div>
                <div id="blogLinks">
                  <div class="hotBlogs hotBlogsNovations">
                    <div class="hotBlog hotBlogNovations"><%= @town_entity.novation %></div>
                    <div class="blogAllLink">
                      <% @hot_novations.each do |item| %>
                        <%= link_to item, novations_path(:time => @time, :town => @town) %>
                      <% end %>
                    </div>
                  </div>
                  <div class="hotBlogs hotBlogsReceipts">
                    <div class="hotBlog hotBlogReceipts"><%= @town_entity.receipt %></div>
                    <div class="blogAllLink">
                      <% @hot_receipts.each do |item| %>
                        <%= link_to item, receipts_path(:time => @time, :town => @town) %>
                      <% end %>
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
        <div id="footer"></div>
      </div>
    </div>
    <%= render(:partial => "shared/analytics") %>
  </body>
</html>